
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page language="java" import="java.lang.*" import="java.sql.*" %>
<html>
    <body border="1" bgcolor="pink" width="650">
    <%
       Connection con = null;
       Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
       con = DriverManager.getConnection("jdbc:sqlserver://localhost:1433;databaseName=JspJavaScript", "sa", "fat123456");
       Statement stmt = null;
    %>

    <form method="get" action="ProcessAction.jsp">
        <h3><p align="center"><font size="5">Employee Information</font></p></h3>
        <br>
        <br>
        <br>
        <br>

        <table cellpadding="5" cellspacing="5" bgcolor="lightblue" colspan="2" rowspan="2" align="center">
            <tr>
                <td><font size="5">Employee ID</font></td>
                <td><font size="5"><input type="text" id="ID" name="empid"></font>
                    <select name="emplds" onchange="document.getElementById('id').value=this.options[this.selectedIndex].text">
                            <option>Select One</option>
                            <%
                            String rec = "Select empid,empname From Employee Order By empid";
                            try{
                                stmt = con.createStatement();
                                ResultSet rs = stmt.executeQuery(rec);
                                while(rs.next()){
                                    %>
                                    <option><%=rs.getInt(1)%></option>
                                    <%
                                }
                            }catch(Exception e){
                                System.out.println(e);
                            }
                            %>
                    </select>
                <td>
            </tr>

            <tr>
                <td> <font size=5> Enter Employee Name </font></td>
                <td><font size=5> <input type="text" name="empname"> </font> </td>
            </tr>
            <tr>
                <td><input type="radio" name="r1" value="add">Insert</td>
            </tr>
            <tr>
                <td><input type="radio" name="r1" value="del">Delete</td>
            </tr>
            <tr>
                <td><input type="radio" name="r1" value="mod">Modify</td>
            </tr>
            <tr>
                <td>
                    <input type="SUBMIT" VALUE="Submit"> 
                    <input type="RESET" value="Reset">
                </td>
            </tr>
        </table>

    </form>
        
    </body>
</html>
